package com.kfm.controller;

import com.kfm.model.Account;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

//@Controller
//@ResponseBody
@RestController
public class JsonstrController {

    @RequestMapping("/str")
//    @ResponseBody
    public String str(){
        return "hello";
    }

    @RequestMapping("/json")
//    @ResponseBody
    public Account account(){
        Account account = new Account();
        account.setId(1212);
        account.setName("李四");
        account.setUsername("lsi");
        account.setPassword("1212a");

        return account;
    }

    @RequestMapping("/json2")
//    @ResponseBody
    public List<Account> listAccount(){
        List<Account> list = new ArrayList<>();
         Account account = new Account();
        account.setId(1212);
        account.setName("李四");
        account.setUsername("lsi");
        account.setPassword("1212a");
        list.add(account);
        return list;
    }

    
}
